#include <iostream>
#include <vector>

using namespace std;
class Solution 
{
public:
    int peakIndexInMountainArray(vector<int>& arr) 
    {
        int left = 1, right = arr.size() - 2;
        int mid = 0;
        while (left < right)
        {
            mid = left + (right - left + 1) / 2;
            if (arr[mid] > arr[mid - 1])
                left = mid;
            else
                right = mid - 1;
        }
        return left;
    }
};
int main()
{
    vector<int> nums{ 0,10,5,2 };

    Solution xz;
    int n = xz.peakIndexInMountainArray(nums);
    cout << n << endl;

	return 0;
}